﻿@model MMCInfo.ViewModels.PatientViewModel

@{
    ViewBag.Title = "UpdatePatient";
}

<h2>Wijzig patient</h2>

@using (Html.BeginForm()) {
    @Html.ValidationSummary(true)
    <fieldset>
        <legend>Wijzig Patient</legend>

        <div class="editor-label">
            @Html.LabelFor(model => model.Initialen)
        </div>
        <div class="editor-field">
            @Html.TextBoxFor(model => model.Initialen, new { disabled="disabed"})
            @Html.ValidationMessageFor(model => model.Initialen)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Achternaam)
        </div>
        <div class="editor-field">
            @Html.TextBoxFor(model => model.Achternaam, new { disabled = "disabed" })
            @Html.ValidationMessageFor(model => model.Achternaam)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.StraatEnNummer)
        </div>
        <div class="editor-field">
            @Html.TextBoxFor(model => model.StraatEnNummer, new { disabled = "disabed" })
            @Html.ValidationMessageFor(model => model.StraatEnNummer)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Postcode)
        </div>
        <div class="editor-field">
            @Html.TextBoxFor(model => model.Postcode, new { disabled = "disabed" })
            @Html.ValidationMessageFor(model => model.Postcode)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Woonplaats)
        </div>
        <div class="editor-field">
            @Html.TextBoxFor(model => model.Woonplaats, new { disabled = "disabed" })
            @Html.ValidationMessageFor(model => model.Woonplaats)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Telefoonnummer)
        </div>
        <div class="editor-field">
            @Html.TextBoxFor(model => model.Telefoonnummer, new { disabled = "disabed" })
            @Html.ValidationMessageFor(model => model.Telefoonnummer)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Geboortedatum)
        </div>
        <div class="editor-field">
            @Html.TextBoxFor(model => model.Geboortedatum, new { disabled = "disabed" })
            @Html.ValidationMessageFor(model => model.Geboortedatum)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Geslacht)
        </div>
        <div class="editor-field">
            @Html.TextBoxFor(model => model.Geslacht, new { disabled = "disabed" })
            @Html.ValidationMessageFor(model => model.Geslacht)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Polisnummer)
        </div>
        <div class="editor-field">
            @Html.TextBoxFor(model => model.Polisnummer, new { disabled = "disabed" })
            @Html.ValidationMessageFor(model => model.Polisnummer)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.ZVID)
        </div>
        <div class="editor-field">
            @Html.DropDownListFor(model => model.ZVID, Model.Zorgverzekeraars, "-Selecteer een zorgverzekeraar-", new { disabled="disabled"})
            @Html.ValidationMessageFor(model => model.ZVID)
        </div>

        @Html.HiddenFor(model => model.PATID)

        <div id="wijzigButton" class="submitUpdatePatient">
            <p>
                <input type="button" value="Wijzig" />
            </p>
        </div>
        <div id="saveButton" class="submitUpdatePatient" style="display: none;">
            <p>
                <input type="submit" value="Sla Op" />
                <input type="button" value="Annuleer" />
            </p>
        </div>
    </fieldset>
}

<div>
    @Html.ActionLink("Bekijk Dossier", "Index")
</div>

<script type="text/javascript">
    $('.submitUpdatePatient input').click(function (e) {
        switch ($(this).val()){
            case 'Wijzig':
                $('input:not(.submitUpdatePatient), textarea, select').removeAttr("disabled");
                $('#wijzigButton').hide();
                $('#saveButton').show();
                break;
            case 'Sla Op':
                
                break;
            case 'Annuleer':
                window.location = window.location;
                break;
            default:
                break;
        }
    });
</script>
